package com.yzd.learnjava.enumerated;

import com.yzd.learnjava.util.Enums;
import com.yzd.learnjava.util.Print;

public enum Meal2 {
	APPETIZER(Food.Appetizer.class),
	MAINCOURSE(Food.MainCourse.class),
	DESSERT(Food.Dessert.class),
	COFFE(Food.Coffe.class);
	
	private Food[] values ;
	private Meal2(Class<? extends Food> kind) {
		values = kind.getEnumConstants();
	}
	interface Food {
		enum Appetizer implements Food{
			SALAD, SOUP, SPRING_ROLLS
		}
		
		enum MainCourse implements Food{
			LASAGNE, BURRITO, PAD_THAI, LENTILS, HUMMOUS, VANDALOO
		}
		
		enum Dessert implements Food{
			TIRANISU, GELATO, BLACK_FOREST_CAKE, FRUIT, CREME_CARAMEL
		}
		
		enum Coffe implements Food{
			BLACK_COOFE, DECAF_COFFE, ESPRESSO, LATTE, CAPPUCCINO, TEA, HERB_TEA
		}
	}
	
	public Food randomSelection() {
		return Enums.random(values);
	}
	
	public static void main(String[] args) {
		for(int i = 0 ; i < 5 ; i++) {
			for(Meal2 m : Meal2.values()) {
				Food food = m.randomSelection();
				Print.print(food);
			}
			Print.print("-----");
		}
	}
}


